class resManager {
	private selfUserInfo: any;
	private code: any;
	private constructor() {

	}
	private static instance: resManager;
	public static getInstance(): resManager {
		if (this.instance == null) {
			this.instance = new resManager();
		}
		return this.instance;
	}
	private ress = [];

	private isInit = false;

	private eyeString = [
		"eyeyou_0",
		"eyeyou_1",
		"eyeyou_2",
		"eyeyou_3",
		"eyeyou_4",
		"eyezuo_0",
		"eyezuo_1",
		"eyezuo_2",
		"eyezuo_3",
		"eyezuo_4",
		"eye_5_png",
	];

	private expressionRes = [];

	private expressionString = [
		"ice_2_png",
		"heixian_png",
		"han_png",
		"eye_black_png",
		"eye_22_png",
		"zhuangtai_1",
		"bowen",
		"shipin_1",
		"shipin_2",
		"shipin_3",
		"shipin_4",
		"shipin_5",
		"eye_1",
		"shetou",
		"shadow_png",
		"hudun_wai",
		"hudun_nei",
		"mojing",
	];

	public loadRes() {
		if (this.isInit) {
			console.log("加载过了");
			return;
		}
		this.isInit = true;
		this.loadFrogEyeRes();
		this.loadLeveUpRes();
		this.loadFrogExpressionRes();
	}
	private leveupStringress = [];
	private leveupString =
	[
		"LevelUp_png",
		"LevelUp_json",
		"_ske_json",
		"_tex_json",
		"_tex_png"
	];
	//眼睛变化
	public loadFrogEyeRes() {

		for (let i = 0; i < this.eyeString.length; i++) {
			this.initResCache(this.eyeString[i], this.ress);
		}


	}
	public loadFrogExpressionRes() {
		for (let i = 0; i < this.expressionString.length; i++) {
			this.initResCache(this.expressionString[i], this.expressionRes);
		}
	}

	/*在此处缓存加载资源*/
	public initResCache(name, list) {
		let obj = RES.getRes(name);
		list.push(obj);
	}


	public loadLeveUpRes() {
		for (let i = 0; i < this.leveupString.length; i++) {

			this.initResCache(this.leveupString[i], this.leveupStringress);


		}

	}

	public getLeveUpRes(index) {
		if (this.leveupStringress.length == 0) {
			console.log("数组长度为空");
			return;
		}
		if (index > this.leveupStringress.length) {
			console.log("数组长度越界" + index + 'dd' + this.ress.length);
			return;
		}
		return this.leveupStringress[index];
	}
	public getResGroups(index) {

		if (this.ress.length == 0) {
			console.log("数组长度为空");
			return;
		}
		if (index > this.ress.length) {
			console.log("数组长度越界" + index + 'dd' + this.ress.length);
			return;
		}
		return this.ress[index];
	}

	public getExpressionGroups(index) {
		if (this.expressionRes.length == 0) {
			console.log("数组长度为空");
			return;
		}
		if (index > this.expressionRes.length) {
			console.log("数组长度越界" + index + 'dd' + this.expressionRes.length);
			return;
		}
		return this.expressionRes[index];
	}

}